export default {
  state: {
    count:0
  },
  getters: {
    oddOrEven(state){
      return state.count%2===1?'奇数':"偶数"
    }
  },
  mutations: {
    increament(state,num){
      state.count+=num
    },
    decreament(state,payload){
      state.count-=payload
    }
  },
  actions: {
    increamentIfOdd(context,num){
      if(context.state.count%2===1){
        context.commit('increament',num)
      }
    },
    increamentAsync({commit},num){
      setTimeout(()=>{
        commit('increament',num)
      },1000)
    }
  },
  modules: {
  }
}